<template>
  <div class="content-wrapper">
    <div class="content-header">修改请求</div>
    <div class="content-container">
      <el-form :inline="true" :model="listQuery" class="filter-container">
        <el-form-item label="表格名称">
          <el-input type="text" size="mini" v-model="listQuery.name"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button
            class="filter-item"
            size="small"
            round
            type="primary"
            icon="el-icon-search"
          >
            搜索
          </el-button>
        </el-form-item>
      </el-form>
      <div>
        <el-table
          height="500"
          v-loading="listLoading"
          :data="pageList"
          highlight-current-row
          style="width: 100%"
        >
          <el-table-column label="表格名称" min-width="200" prop="documentName"> 
          </el-table-column>
          <el-table-column label="版本" width="160px" prop="version" />
          <el-table-column label="上传时间" width="160px" prop="updateTime"  />
          <el-table-column label="请求人" width="160px" prop="date" />
          <el-table-column
            label="操作"
            align="center"
            width="150px"
            fixed="right"
          >
            <template slot-scope="{ row }">
              <el-dropdown trigger="click" class="filter-item">
                <el-button type="text" class="el-icon-more" />
                <el-dropdown-menu slot="dropdown" class="user-dropdown">
                  <!-- <el-dropdown-item>预览</el-dropdown-item> -->
                  <el-dropdown-item  @click.native="modifiCation(row)">编辑</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <pagination
        v-show="total > 0"
        :total="total"
        :page-number.sync="listQuery.pageNumber"
        :page-size.sync="listQuery.pageSize"
        @pagination="getList"
      />
    </div>
        <Create
      :dialogVisible="dialogVisibleCreate"
      v-on:pageDataReload="pageDataReload"
    ></Create>
  </div>
</template>
<script>
import Pagination from '@/components/Pagination'
import { getModificationList} from '@/api/rs/record_template'
import Create from '@/views/record/components/create.vue'
export default {
  components: {
    Pagination,
    Create
  },
  data() {
    return {
      listLoading: false,
      pageList: [{}],
      listQuery: {
        pageNumber: 1,
        pageIndex: 0,
        pageSize: 10
      },
      total:0,
      dialogVisibleCreate:''
    }
  },
  mounted() {
    this.getList()
    this.getModificationList()
  },
  methods: {
    getList() {
      //   this.listLoading = true
      this.listQuery.pageIndex = this.listQuery.pageNumber - 1
    },
    async getModificationList() {
      let data =await getModificationList({
        pageIndex: this.listQuery.pageIndex,
        pageSize: this.listQuery.pageSize
      })
      this.pageList=data.data.rows
      this.total=data.data.total
    },
        //修改
    modifiCation(row) {
      this.dialogVisibleCreate = {
        dialogVisible: true,
        label: '修改',
        sort: '2',
        recordTemplateId: row.recordTemplateId
      }
    },
    pageDataReload(data){
      console.log(data);
    }
  }
}
</script>
